<?php
class Solution {

    /**
     * @param Integer[] $nums
     * @return Integer
     */
    function majorityElement($nums) {
        if (!is_array($nums))
            return null;
        sort($nums);
        $index = count($nums) >> 1;
        return $nums[$index];
    }
}
